package restaurant.gui.simulation;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.JTextArea;
import javax.swing.JToggleButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.EtchedBorder;

/**
 *
 * @author Odessa
 */
public class ReportsFrame extends javax.swing.JFrame {

    /** Creates new form ReportsFrame */
    public ReportsFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new JPanel();
        topPanel = new JPanel();
        simulationLabel = new JLabel();
        logoLabel = new JLabel();
        optionsPanel = new JPanel();
        numTablesLabel = new JLabel();
        numTablesSpinner = new JSpinner();
        arrivalLabel = new JLabel();
        arrivalRateSpinner = new JSpinner();
        numTablesLabel2 = new JLabel();
        numTablesSpinner2 = new JSpinner();
        numTablesLabel3 = new JLabel();
        numTablesSpinner3 = new JSpinner();
        orderStrategyCB = new JComboBox();
        orderStrategyLabel = new JLabel();
        dataPanel = new JPanel();
        taScrollPane = new JScrollPane();
        simRunTextArea = new JTextArea();
        startButton = new JToggleButton();
        stopButton = new JToggleButton();

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

        mainPanel.setLayout(new BorderLayout());

        topPanel.setBorder(BorderFactory.createEtchedBorder());
        topPanel.setLayout(new BorderLayout(50, 0));

        simulationLabel.setFont(new Font("Tahoma", 0, 16));
        simulationLabel.setHorizontalAlignment(SwingConstants.CENTER);
        simulationLabel.setText("Simulation");
        simulationLabel.setHorizontalTextPosition(SwingConstants.CENTER);
        simulationLabel.setPreferredSize(new Dimension(20, 20));
        topPanel.add(simulationLabel, BorderLayout.CENTER);

        logoLabel.setPreferredSize(new Dimension(20, 0));
        topPanel.add(logoLabel, BorderLayout.WEST);

        mainPanel.add(topPanel, BorderLayout.NORTH);

        optionsPanel.setBorder(BorderFactory.createEtchedBorder());

        numTablesLabel.setText("Number of tables");

        arrivalLabel.setText("Customer arrival rate");

        numTablesLabel2.setText("Numer of tables");

        numTablesLabel3.setText("Numer of tables");

        orderStrategyCB.setModel(new DefaultComboBoxModel(new String[] { "First in, first out", "Similar items", "Minimum prep time" }));
        orderStrategyCB.setSelectedIndex(-1);

        orderStrategyLabel.setText("Order strategy");

        GroupLayout optionsPanelLayout = new GroupLayout(optionsPanel);
        optionsPanel.setLayout(optionsPanelLayout);
        optionsPanelLayout.setHorizontalGroup(
            optionsPanelLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(optionsPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(numTablesLabel)
                    .addComponent(arrivalLabel)
                    .addComponent(numTablesLabel2)
                    .addComponent(numTablesLabel3)
                    .addComponent(orderStrategyLabel))
                .addPreferredGap(ComponentPlacement.RELATED)
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.LEADING)
                    .addComponent(numTablesSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(arrivalRateSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(numTablesSpinner2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(numTablesSpinner3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(orderStrategyCB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addContainerGap(96, Short.MAX_VALUE))
        );

        optionsPanelLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] {arrivalRateSpinner, numTablesSpinner, numTablesSpinner2, numTablesSpinner3, orderStrategyCB});

        optionsPanelLayout.setVerticalGroup(
            optionsPanelLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(optionsPanelLayout.createSequentialGroup()
                .addGap(49, 49, 49)
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(numTablesLabel)
                    .addComponent(numTablesSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(arrivalLabel)
                    .addComponent(arrivalRateSpinner, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(numTablesLabel2)
                    .addComponent(numTablesSpinner2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(numTablesLabel3)
                    .addComponent(numTablesSpinner3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(optionsPanelLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(orderStrategyLabel)
                    .addComponent(orderStrategyCB, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                .addGap(256, 256, 256))
        );

        mainPanel.add(optionsPanel, BorderLayout.WEST);

        dataPanel.setBorder(BorderFactory.createEtchedBorder());

        simRunTextArea.setColumns(20);
        simRunTextArea.setRows(5);
        taScrollPane.setViewportView(simRunTextArea);

        startButton.setText("Start");
        startButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                startButtonActionPerformed(evt);
            }
        });

        stopButton.setText("Stop");
        stopButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                stopButtonActionPerformed(evt);
            }
        });

        GroupLayout dataPanelLayout = new GroupLayout(dataPanel);
        dataPanel.setLayout(dataPanelLayout);
        dataPanelLayout.setHorizontalGroup(
            dataPanelLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(dataPanelLayout.createSequentialGroup()
                .addGroup(dataPanelLayout.createParallelGroup(Alignment.LEADING)
                    .addGroup(dataPanelLayout.createSequentialGroup()
                        .addGap(113, 113, 113)
                        .addComponent(taScrollPane, GroupLayout.PREFERRED_SIZE, 389, GroupLayout.PREFERRED_SIZE))
                    .addGroup(dataPanelLayout.createSequentialGroup()
                        .addGap(203, 203, 203)
                        .addComponent(startButton)
                        .addPreferredGap(ComponentPlacement.UNRELATED)
                        .addComponent(stopButton)))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        dataPanelLayout.setVerticalGroup(
            dataPanelLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(dataPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(taScrollPane, GroupLayout.PREFERRED_SIZE, 352, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(ComponentPlacement.UNRELATED)
                .addGroup(dataPanelLayout.createParallelGroup(Alignment.BASELINE)
                    .addComponent(startButton)
                    .addComponent(stopButton))
                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        mainPanel.add(dataPanel, BorderLayout.CENTER);

        getContentPane().add(mainPanel, BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void startButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_startButtonActionPerformed

    private void stopButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_stopButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ReportsFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ReportsFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ReportsFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ReportsFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ReportsFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private JLabel arrivalLabel;
    private JSpinner arrivalRateSpinner;
    private JPanel dataPanel;
    private JLabel logoLabel;
    private JPanel mainPanel;
    private JLabel numTablesLabel;
    private JLabel numTablesLabel2;
    private JLabel numTablesLabel3;
    private JSpinner numTablesSpinner;
    private JSpinner numTablesSpinner2;
    private JSpinner numTablesSpinner3;
    private JPanel optionsPanel;
    private JComboBox orderStrategyCB;
    private JLabel orderStrategyLabel;
    private JTextArea simRunTextArea;
    private JLabel simulationLabel;
    private JToggleButton startButton;
    private JToggleButton stopButton;
    private JScrollPane taScrollPane;
    private JPanel topPanel;
    // End of variables declaration//GEN-END:variables
}
